from django.conf.urls import url

from backend.api import ApiDoc, automationCase as Case, member, dynamic, user, VisitorRecord, DingManage
from backend.common import common_function
from backend.case import lyzdCase, lyzdCGCase
from backend.common.create_script import createScript
from backend.datebase.datebaseConfig import LyzdDBConfigList, AddDatabase, LyzdTableConfigList, AddTable, \
    LyzdTableBackUpGetTables
from backend.encryption import Lyzd_java_decrypt
from backend.encryption.Lyzd_java_decrypt import JAVAInterface
from backend.encryption.encryption import getLyzdEncryptions
from backend.interface import lyzdInterface
from backend.api import automationReport as Report
from backend.api.global_parameter import HostTotal, AddHost, UpdateHost, DelHost, DisableHost, EnableHost
from backend.api.projectList import ProjectList, AddProject, DelProject, \
    EnableProject, UpdateProject, DisableProject
# 高靖宇add 环境、增加环境
from backend.environment.lyzdEnvironmentList import LyzdEnvironmentList, AddEnvironment, DelEnvironment, \
    UpdateEnvironment, EditStatusEnvironment
from backend.case.lyzdCase import LyzdCaseList, EditStatusCase, DownloadCG, LyzdCaseCGList
from backend.interface.import_case import CaseExcleImport
from backend.interface.import_Interface import InterfaceExcleImport
from backend.interface.Templatedownload import InterfaceTemplateDownload, \
    CaseTemplateDownload
from backend.interface.lyzdInterface import LyzdInterfaceList, EditStatusApi
from backend.littleTools import projectexport
from backend.model.lyzdModelList import LyzdModelList, AddModel, EditStatusModel, UpdateModel
from backend.project.LyzdProjectList import LyzdProjectList, AddLyzdProject, UpdateLyzdProject, EditStatusProject
from backend.runResult.runResult import getRunResult, getResultDetail, getResultDetailByID, getRunResultByPici

from backend.api.projectTitle import ProjectInfo
from backend.autoScript.lyzdScript import LyzdScriptList
from backend.setting.dingding import LyzdDingDingList, AddDingDing, DelDingDing, EditStatusDingDing, UpdateDingDing

urlpatterns = [

    # url(r'MiniProgramAPI/', include('MiniProgramAPI.urls')),  # 对外接口
    # url(r'project/getResult', getResult.as_view()),  # 迁移代码
    url(r'api/add_interface', lyzdInterface.AddIntface.as_view()),
    url(r'api/edit_interface', lyzdInterface.EditIntface.as_view()),
    url(r'api/copy_interface', lyzdInterface.CopyIntface.as_view()),

    url(r'api/addCase', lyzdCase.AddCase.as_view()),
    url(r'api/updateCase', lyzdCase.CaseEdit.as_view()),

    # url("project/autotestapi/", views.AutotestApi.as_view()),#迁移代码
    # 设置公用方法 高靖宇
    url(r'api/getProjectList', common_function.project.as_view()),
    # 获取用途Application
    url(r'api/getApplicationList', common_function.Application.as_view()),

    url(r'api/getEnvironmentList', common_function.environment.as_view()),
    url(r'title/lyzd_home', common_function.LyzdHome.as_view()),
    # 导入接口信息
    # url(r'api/ExcleImport',ExcleImport.as_view()),
    # url(r'api/getAPIList', common_function.APIList.as_view()),
    url(r'api/getModelList', common_function.model.as_view()),
    url(r'api/getYiLaiApiList', common_function.yilaiApi.as_view()),
    url(r'api/getApiList', common_function.yilaiApi.as_view()),  # 同上
    # 接口信息导入
    url(r'api/InterfaceExcleImport', InterfaceExcleImport.as_view()),
    # 接口模板下载
    url(r'api/InterfaceTemplateDownload', InterfaceTemplateDownload.as_view()),  # 同上
    # 用例导入
    url(r'api/CaseExcleImport', CaseExcleImport.as_view()),
    # 用例导入
    url(r'api/CGCaseExcleImport', lyzdCGCase.CGCaseExcleImport.as_view()),
    # 用例模板下载
    url(r'api/CaseTemplateDownload', CaseTemplateDownload.as_view()),
    # 下载常规校验模板
    url(r'api/DownloadCG2', DownloadCG.as_view()),
    url(r'api/DownloadPM', projectexport.DownloadPM.as_view()),
    url(r'api/getInterfaceByProjectId', common_function.getApiByProjectID.as_view()),  # 同上
    url(r'api/case_getHeader', common_function.CaseGetHeaderAndParam.as_view()),
    url(r'api/case_getParam', common_function.CaseGetParam.as_view()),
    # getProjectList
    # 设置公用方法 高靖宇
    url(r'api/getCaseTypeList', common_function.CaseType.as_view()),
    url(r'api/getCheckTypeList', common_function.CheckType.as_view()),
    url(r'api/getCheckConditionList', common_function.CheckCondition.as_view()),  # getCheckConditionList
    url(r'api/getActionConditionList', common_function.ActionCondition.as_view()),  # getCheckConditionList
    url(r'api/group', ApiDoc.Group.as_view()),
    url(r'project/add_project', AddProject.as_view()),
    url(r'user/dingConfig', DingManage.DingManage.as_view()),
    # url(r'user/dingLogin', DingManage.DingLogin.as_view()),
    url(r'project/getRunResult', getRunResult.as_view()),
    url(r'report/resultDetail_info', getResultDetail.as_view()),
    url(r'report/getResultDetailByID', getResultDetailByID.as_view()),
    # echarts
    url(r'report/getRunResultByPici', getRunResultByPici.as_view()),
    url(r'project/interface_list', LyzdInterfaceList.as_view()),
    # getLyzdCaseList
    # url(r'api/getCasebyApiID', common_function.getCasebyApiID.as_view()),
    # url(r'project/project_list', ProjectList.as_view()),
    url(r'project/getCasebyApiID', common_function.getCasebyApiID.as_view()),
    url(r'project/getLyzdCaseList', LyzdCaseList.as_view()),
    url(r'project/getLyzdCaseCGList', LyzdCaseCGList.as_view()),
    url(r'project/getJavaDecrypt', JAVAInterface.as_view()),

    url(r'project/getLyzdScriptList', LyzdScriptList.as_view()),

    # url(r'project/getDatebaseList', LyzdDBConfigList.as_view()),

    # url(r'project/getTablebyDbID', LyzdTableBackUpGetTables.as_view()),

    # url(r'project/getTableList', LyzdTableConfigList.as_view()),

    url(r'project/project_list', ProjectList.as_view()),

    url(r'project/environment_list', LyzdEnvironmentList.as_view()),
    url(r'project/dingding_list', LyzdDingDingList.as_view()),

    # 192.168.16.91报404
    url(r'project/lyzdProjectLists', LyzdProjectList.as_view()),
    url(r'project/getLyzdEncryptions', getLyzdEncryptions.as_view()),

    url(r'project/model_list', LyzdModelList.as_view()),

    url(r'project/add_model', AddModel.as_view()),
    url(r'project/editModelStatus', EditStatusModel.as_view()),

    url(r'project/add_environment', AddEnvironment.as_view()),
    url(r'project/add_dingding', AddDingDing.as_view()),
    url(r'project/add_database', AddDatabase.as_view()),
    url(r'project/add_table', AddTable.as_view()),
    url(r'project/del_environment', DelEnvironment.as_view()),
    url(r'project/del_dingding', DelDingDing.as_view()),

    url(r'api/editStatus_environment', EditStatusEnvironment.as_view()),
    url(r'api/editStatus_dingding', EditStatusDingDing.as_view()),
    url(r'api/editStatus_api', EditStatusApi.as_view()),
    url(r'api/editStatus_case', EditStatusCase.as_view()),

    # 运行
    url(r'project/runApi', common_function.runApi.as_view()),
    url(r'project/ProcesstTesting', common_function.ProcesstTesting.as_view()),
    # 生成脚本
    url(r'project/createScript', createScript.as_view()),

    url(r'project/update_environment', UpdateEnvironment.as_view()),
    url(r'project/update_dingding', UpdateDingDing.as_view()),
    url(r'project/update_model', UpdateModel.as_view()),
    # addLyzdProject

    url(r'project/editProjectStatus', EditStatusProject.as_view()),
    url(r'project/addLyzdProject', AddLyzdProject.as_view()),
    url(r'project/updateLyzdProject', UpdateLyzdProject.as_view()),

    url(r'project/add_project', AddProject.as_view()),
    url(r'project/update_project', UpdateProject.as_view()),
    url(r'project/del_project', DelProject.as_view()),
    url(r'project/disable_project', DisableProject.as_view()),
    url(r'project/enable_project', EnableProject.as_view()),
    url(r'title/project_info', ProjectInfo.as_view()),

    url(r'global/host_total', HostTotal.as_view()),
    url(r'global/add_host', AddHost.as_view()),
    # add_host  增加host配置
    url(r'global/update_host', UpdateHost.as_view()),
    url(r'global/del_host', DelHost.as_view()),
    url(r'global/disable_host', DisableHost.as_view()),
    url(r'global/enable_host', EnableHost.as_view()),
    # url(r'api/group', ApiDoc.Group.as_view()),
    url(r'api/add_group', ApiDoc.AddGroup.as_view()),
    url(r'api/update_name_group', ApiDoc.UpdateNameGroup.as_view()),
    url(r'api/del_group', ApiDoc.DelGroup.as_view()),
    url(r'api/api_list', ApiDoc.ApiList.as_view()),
    url(r'api/add_api', ApiDoc.AddApi.as_view()),
    url(r'api/updateMock', ApiDoc.UpdateApiMockStatus.as_view()),
    url(r'api/lead_swagger', ApiDoc.LeadSwagger.as_view()),
    url(r'api/update_api', ApiDoc.UpdateApi.as_view()),
    url(r'api/del_api', ApiDoc.DelApi.as_view()),
    url(r'api/update_group', ApiDoc.UpdateGroup.as_view()),
    url(r'api/api_info', ApiDoc.ApiInfoDetail.as_view()),

    url(r'api/add_history', ApiDoc.AddHistory.as_view()),
    url(r'api/history_list', ApiDoc.HistoryList.as_view()),
    url(r'api/del_history', ApiDoc.DelHistory.as_view()),
    url(r'api/operation_history', ApiDoc.OperationHistory.as_view()),
    url(r'api/Download', ApiDoc.DownLoad.as_view()),
    url(r'api/download_doc', ApiDoc.download_doc),
    url(r'automation/group', Case.Group.as_view()),

    url(r'automation/add_group', Case.AddGroup.as_view()),
    url(r'automation/del_group', Case.DelGroup.as_view()),
    url(r'automation/update_name_group', Case.UpdateNameGroup.as_view()),
    url(r'automation/update_case_group', Case.UpdateGroup.as_view()),
    url(r'automation/case_list', Case.CaseList.as_view()),
    url(r'automation/add_case', Case.AddCase.as_view()),
    url(r'automation/update_case', Case.UpdateCase.as_view()),
    url(r'automation/del_case', Case.DelCase.as_view()),
    url(r'automation/DownloadCase', Case.DownLoadCase.as_view()),
    url(r'automation/api_list', Case.ApiList.as_view()),
    # url(r'automation/api_edit', Case.CaseApiEdit.as_view()),

    # url(r'interface/api_info', Case.CaseApiInfo.as_view()),

    url(r'interface/api_edit', lyzdInterface.ApiEdit.as_view()),

    url(r'case/case_info', lyzdCase.CaseInfo.as_view()),

    url(r'automation/add_new_api', Case.AddNewApi.as_view()),
    url(r'automation/get_correlation_response', Case.GetCorrelationResponse.as_view()),
    url(r'automation/add_old_api', Case.AddOldApi.as_view()),
    url(r'automation/update_api', Case.UpdateApi.as_view()),
    url(r'automation/del_api', Case.DelApi.as_view()),
    url(r'automation/start_test', Case.StartTest.as_view()),
    url(r'automation/add_time_task', Case.AddTimeTask.as_view()),
    url(r'automation/get_time_task', Case.GetTask.as_view()),
    url(r'automation/del_task', Case.DelTask.as_view()),
    url(r'automation/look_result', Case.LookResult.as_view()),
    url(r'automation/test_report', Case.TestReport.as_view()),
    url(r'report/auto_test_report', Report.AutoTestReport.as_view()),
    url(r'report/test_time', Report.TestTime.as_view()),
    url(r'report/lately_ten', Report.AutoLatelyTenTime.as_view()),
    url(r'member/project_member', member.ProjectMemberList.as_view()),
    url(r'member/email_config', member.EmailConfig.as_view()),
    url(r'member/del_email', member.DelEmail.as_view()),
    url(r'member/get_email', member.GetEmail.as_view()),
    url(r'dynamic/dynamic', dynamic.Dynamic.as_view()),
    url(r'user/login', user.obtain_auth_token),
    url(r'user/VisitorRecord', VisitorRecord.Record.as_view()),
]
